package com.gd.iot.energy.service.datamanage.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gd.iot.energy.consts.SystemConsts;
import com.gd.iot.energy.dao.datamanage.EquipInstructionPOMapper;
import com.gd.iot.energy.po.datamanage.EquipInstructionPOWithBLOBs;
import com.gd.iot.energy.service.datamanage.EquipInstructionService;
import org.springframework.stereotype.Service;

/**
 * @author kris
 * @date 2020/8/28 0028 14:16
 */
@Service
public class EquipInstructionServiceImpl extends ServiceImpl<EquipInstructionPOMapper, EquipInstructionPOWithBLOBs> implements EquipInstructionService {

    @Override
    public EquipInstructionPOWithBLOBs getInstructionByConcentPhone(final String collect, final String phone) {
        if (StrUtil.isBlank(collect) || StrUtil.isBlank(phone)) {
            return null;
        }
        QueryWrapper<EquipInstructionPOWithBLOBs> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("concent_phone",phone);
        queryWrapper.eq("collect_number",collect);
        queryWrapper.eq("connect_state", SystemConsts.ConnectStateEnum.NORMAL.value);

        return getOne(queryWrapper);
    }

}
